package livingarea.Members;

import livingarea.other.Coordinates;

/**
 *
 * @author Muzalevskiy Vitaliy
 */
public class Position {

    private int x;
    private int y;

    public Position(int x, int y) {
        if(x < 0 || y < 0){
            throw new IllegalArgumentException("Parameters must be positive!");
        }
        if(y > Coordinates.DEFAULT_HEIGHT){
            throw new IllegalArgumentException(" Positiin outside of the limits!");
        }
        if(x > Coordinates.DEFAULT_LENGTH){
            throw new IllegalArgumentException(" Positiin outside of the limits!");
        }
        this.x = x;
        this.y = y;
    }  

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Position other = (Position) obj;
        if (this.getX() != other.getX()) {
            return false;
        }
        if (this.getY() != other.getY()) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 79 * hash + this.x;
        hash = 79 * hash + this.y;
        return hash;
    }

    /**
     * @return the x
     */
    public int getX() {
        return x;
    }

    /**
     * @return the y
     */
    public int getY() {
        return y;
    }
    
    
}
